package net.tycmc.cty.ctyms.timejob.iems.service;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.tycmc.functions.MapFunction;

import net.tycmc.bulb.common.util.CurrentDate;
import net.tycmc.bulb.common.util.DateUtil;
import net.tycmc.bulb.common.util.MapGetter;
import net.tycmc.bulb.common.util.StringUtil;
import net.tycmc.cty.ctyms.timejob.common.DateControl;
import net.tycmc.cty.ctyms.timejob.common.DateList;
import net.tycmc.cty.ctyms.timejob.common.NumberFormat;
import net.tycmc.cty.ctyms.timejob.common.SMSCfgType;
import net.tycmc.cty.ctyms.timejob.common.SMSContentCfg;
import net.tycmc.cty.ctyms.timejob.common.SMSPromptType;
import net.tycmc.cty.ctyms.timejob.iems.dao.DrivingBehaviorDAO;
import net.tycmc.cty.ctyms.timejob.iems.dao.SMSInfoDAO;

/**
 * 驾驶行为统计相关业务逻辑操作
 * 
 * @author liuhuanhuan
 */
public class DrivingBehaviorService {
	// 循环驾驶行为，将提示信息插入到驾驶行为提示列表中的SQL容器，目前仅驾驶行为提示中使用到了
	private List<String> sqlTipList = null;
	private List<Object[]> paramTipList = null;
	private Map<String,Object> userInfos = null;//驾驶行为提示需要发送短信的人员信息
	private List<Map<String, Object>> locNameList = null;//驾驶行为事件中文名称

	private DrivingBehaviorDAO drivingBehaviorDAO;

	private SMSInfoDAO smsInfoDAO;

	// 统计11种驾驶行为
	public void calDrivingBehaviorHandle() {

		// 怠速统计
		drivingBehaviorDAO.CalIdle();
		// // 定速巡航统计
		drivingBehaviorDAO.CalCruise();

		// 其他9种驾驶行为统计
		// 驾驶行为提示列表查询
		String MaxID = this.drivingBehaviorDAO.getMaxEventID();
	    String statDate = DateUtil.addDay(-1);
	    System.out.println(statDate+"日最大id为" + MaxID);
	    boolean flag = false;
		for(int i=0; i < Integer.parseInt(MaxID);i++){
			if (flag) {
		        return;
		      }
			String[] eventIDDef = this.drivingBehaviorDAO.getEventID(MaxID);
			List<Map<String, Object>> list = drivingBehaviorDAO.drivingBehavior(eventIDDef);
			if (eventIDDef[1].equals(MaxID)) {
		        flag = true;
		      }
			/*wangkai20141016，
			 * 3.6.6新增驾驶行为提示开关判断，判断逻辑如下
			 * 1，从提示开关表中获取“传感器提示开关”为关的设备id集合
			 * 2，对获取到的所有设备进行筛选如果设备号在“驾驶行为提示开关”为关的设备id集合内则不处理
			*/
			/******************获取传感器提示开关为关的设备id的集合begin******************/
			List<String> caldrivingBehaviorPS = drivingBehaviorDAO.getdrivingPromtPSwitch();
			/******************获取传感器提示开关为关的设备id的集合end********************/
			// 循环驾驶行为，将提示信息插入到驾驶行为提示列表中
			List<String> sqlList = new ArrayList<String>();
			for (Iterator<Map<String, Object>> iterator = list.iterator(); iterator
					.hasNext();) {
				Map<String, Object> map = (Map<String, Object>) iterator.next();
				//对获取到的所有设备进行筛选如果设备号在“驾驶行为提示开关”为关的设备id集合内则不处理
				if (!caldrivingBehaviorPS.contains(MapGetter.getString(map,"MsgER_Vcl_ID"))) {
					
					int SysE_ID = getInt(map, "MsgERC_SysE_ID"); // 获取事件类型ID
	
					switch (SysE_ID) {
					case 1: // 怠速时间过长事件
						sqlList.add(getInsertDrivingStatisticSql(map, 2));
						break;
					case 2:// 超速行驶1事件
						sqlList.add(getInsertDrivingStatisticSql(map, 3));
						break;
					case 3:// 空挡踩油门事件
						sqlList.add(getInsertDrivingStatisticSql(map, 10));
						break;
					case 4:// 低档高速事件
						sqlList.add(getInsertDrivingStatisticSql(map, 4));
						break;
					case 5:// 疲劳驾驶事件
						sqlList.add(getInsertDrivingStatisticSql(map, 8));
						break;
					case 6:// 急加速事件
						sqlList.add(getInsertDrivingStatisticSql(map, 5));
						break;
					case 7:// 全油门事件
						sqlList.add(getInsertDrivingStatisticSql(map, 6));
						break;
					case 8:// 急刹车事件
						sqlList.add(getInsertDrivingStatisticSql(map, 7));
						break;
					case 9:// 空挡滑行事件
						String bgnTime = MapGetter.getString(map, "MsgERC_BgnTime");
						String endTime = MapGetter.getString(map, "MsgERC_EndTime");
						String vclId = MapGetter.getString(map, "MsgER_Vcl_ID");
						String tableName = DateUtil.addDay(-1).replace("-", "");
						float runKm = drivingBehaviorDAO.getRunKm(bgnTime, endTime,
								vclId, tableName);
						map.put("MsgERC_RunKm", runKm);
						sqlList.add(getInsertDrivingStatisticSql(map, 11));
						break;
					case 10:// 超速行驶2事件
						sqlList.add(getInsertDrivingStatisticSql(map, 12));
						break;
	
					}
				}
			}
			drivingBehaviorDAO.drivingBehaviorTipIn(sqlList, null);
			/*if(list.size()<8000){
				eventIDDef[1]=eventIDDef[0]+list.size();
			}*/
			if(Integer.parseInt(eventIDDef[1])>0){
				this.drivingBehaviorDAO.updateEventID(eventIDDef[1]);
			}
		}
	}

	private String getInsertDrivingStatisticSql(Map<String, Object> map,
			int SysE_ID) {
		int gt4HSec = (int)getFloat(map, "continuedTimeSec")-3600*4;
		if(gt4HSec<0)
			gt4HSec = 0;
		String sql = "INSERT INTO DrivingStatistic(Ds_VclId,Ds_TipType,Ds_BgnTime,Ds_EndTime,Ds_Lo,Ds_La,Ds_MaxSpeed,Ds_AverageSpeed,Ds_BgnSpeed,Ds_EndSpeed,Ds_MaxASpeed,Ds_AverageASpeed,Ds_AverageOilPer,Ds_ContinuedRunMin,Ds_ContinuedRunKm,Ds_ContinuedRunSec,DS_RecordTimes,Ds_ContinuedRunSecGt4H) "
				+ "VALUES("
				+ MapGetter.getString(map, "MsgER_Vcl_ID")
				+ ","
				+ SysE_ID
				+ ",'"
				+ MapGetter.getString(map, "MsgERC_BgnTime")
				+ "','"
				+ MapGetter.getString(map, "MsgERC_EndTime")
				+ "','"
				+ MapGetter.getString(map, "MsgERC_Lo")
				+ "','"
				+ MapGetter.getString(map, "MsgERC_La")
				+ "',"
				+ getFloat(map, "MsgERC_MaxSpeed")
				+ ","
				+ getFloat(map, "MsgERC_AvgSpeed")
				+ ","
				+ getFloat(map, "MsgERC_BgnSpeed")
				+ ","
				+ getFloat(map, "MsgERC_EndSpeed")
				+ ","
				+ getFloat(map, "MsgERC_MaxAddSpeed")
				+ ","
				+ getFloat(map, "MsgERC_AvgAddSpeed")
				+ ","
				+ getFloat(map, "MsgERC_AvgThrottle")
				+ ","
				+ getFloat(map, "continuedTime")
				+ ","
				+ getFloat(map, "MsgERC_RunKm") 
				+ ","
				+ getFloat(map, "continuedTimeSec")
				+","
				+ getFloat(map, "MsgERC_RecordTimes")
				+","
				+ gt4HSec+")";
		return sql;
	}

	// 9种驾驶行为提示
	public void drivingBehaviorTipHandle() {
		String[] eventIDDef = this.drivingBehaviorDAO.getEventIDDef();
		List<Map<String, Object>> list = drivingBehaviorDAO.drivingBehaviorTip(eventIDDef);
		Map<String,Map<String,Object>> vclsMap = drivingBehaviorDAO.getVclMap();
		// 循环驾驶行为，将提示信息插入到驾驶行为提示列表中
		List<String> sqlList = new ArrayList<String>();
		List<Object[]> paramList = new ArrayList<Object[]>();
		for (Iterator<Map<String, Object>> iterator = list.iterator(); iterator
				.hasNext();) {
			Map<String, Object> map = (Map<String, Object>) iterator.next();
			if(!vclsMap.containsKey(MapGetter.getString(map, "MsgER_Vcl_ID")))continue;
			Map<String,Object> vclMap = vclsMap.get(MapGetter.getString(map, "MsgER_Vcl_ID"));
			int SysE_ID = getInt(map, "MsgERC_SysE_ID"); // 获取事件类型ID
			//驾驶行为事件名称(1:中文)
			List<Map<String, Object>> locNameList = drivingBehaviorDAO.getLocNameList(1);
			
			int handlerSysE_ID = 0;
			String tipContent = "";
			String tipContentShort = "";
			String sql = "";
			String eventName = "";
			switch (SysE_ID) {
			case 1: // 怠速时间过长事件
			{
				int driverTotal_H = getInt(map, "continuedTimeSec")/3600;
				int driverTotal_M = getInt(map, "continuedTimeSec")%3600/60;
				int driverTotal_S = getInt(map, "continuedTimeSec")%3600%60;
				handlerSysE_ID = 2;
				eventName = "怠速时间过长";
				tipContent = "开始时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ "<br/>结束时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ "<br/>总怠速时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>地点：";
				tipContentShort = "开始："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ " 结束："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ " 总怠速时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>地点：";
				try {
					String pos = "";
					if (!StringUtil.isNullOrEmpty(pos))
						pos = "未知";
					tipContent += pos;
					tipContentShort += pos;
				} catch (Exception e) {
					tipContent += "未知";
					tipContentShort += "未知";
				}
				sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),'"
						+ tipContent
						+ "','',"
						+ handlerSysE_ID
						+ ",'"
						+ MapGetter.getString(map, "MsgER_RcvTime") + "',?)";
				sqlList.add(sql);
				paramList.add(new Object[] {
						MapGetter.getString(map, "MsgER_Vcl_ID"),
						tipContentShort });
				break;
			}
			case 2:// 超速行驶1事件(高速行驶)
			{
				handlerSysE_ID = 3;
				eventName = MapGetter.getString(locNameList.get(2), "locName");
				int driverTotal_H = getInt(map, "continuedTimeSec")/3600;
				int driverTotal_M = getInt(map, "continuedTimeSec")%3600/60;
				int driverTotal_S = getInt(map, "continuedTimeSec")%3600%60;
				tipContent = "开始时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ "<br/>结束时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ "<br/>"+MapGetter.getString(locNameList.get(2), "locName")+"时长：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>地点：";
				tipContentShort = "开始："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ " 结束："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ ""+MapGetter.getString(locNameList.get(2), "locName")+"时长：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>地点：";
				try {
					String pos = "";
					if (!StringUtil.isNullOrEmpty(pos))
						pos = "未知";
					tipContent += pos;
					tipContentShort += pos;
				} catch (Exception e) {
					tipContent += "未知";
					tipContentShort += "未知";
				}
				double avgSpeed = 0;
				if(StringUtil.isNullOrEmpty(MapGetter.getString(map, "continuedTime"))
						&&getFloat(map, "continuedTime")!=0){
					avgSpeed = NumberFormat.div(getFloat(map, "MsgERC_RunKm")*3600, getFloat(map, "continuedTimeSec"));
				}
				tipContent += 
					"<br/>平均车速："+avgSpeed+"公里/小时" +
						"<br/>最大车速："+getFloatDis(map, "MsgERC_MaxSpeed")+"" +
								"<br/>持续里程："+getFloatDis(map, "MsgERC_RunKm")+"" +
										"<br/>车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
				
				tipContentShort += 
					"平均车速："+avgSpeed+
						"公里/小时 最大车速："+getFloatDis(map, "MsgERC_MaxSpeed")+
							" 持续里程："+getFloatDis(map, "MsgERC_RunKm")+
								" 车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
				
				sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),'"
						+ tipContent
						+ "','',"
						+ handlerSysE_ID
						+ ",'"
						+ MapGetter.getString(map, "MsgER_RcvTime") + "',?)";
				sqlList.add(sql);
				paramList.add(new Object[] {
						MapGetter.getString(map, "MsgER_Vcl_ID"),
						tipContentShort });
				break;
			}
			case 3:// 空挡踩油门事件
			{
				handlerSysE_ID = 10;
				eventName = MapGetter.getString(locNameList.get(8), "locName");
				tipContent = "发生时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0);
				tipContentShort = "发生时间："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0);
				sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),'"
						+ tipContent
						+ "','',"
						+ handlerSysE_ID
						+ ",'"
						+ MapGetter.getString(map, "MsgER_RcvTime") + "',?)";
				sqlList.add(sql);
				paramList.add(new Object[] {
						MapGetter.getString(map, "MsgER_Vcl_ID"),
						tipContentShort });
				break;
			}
			case 4:// 低档高速事件
			{
				handlerSysE_ID = 4;
				int driverTotal_H = getInt(map, "continuedTimeSec")/3600;
				int driverTotal_M = getInt(map, "continuedTimeSec")%3600/60;
				int driverTotal_S = getInt(map, "continuedTimeSec")%3600%60;
				eventName = MapGetter.getString(locNameList.get(3), "locName");
				tipContent = "开始时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ "<br/>结束时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ "<br/>持续时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>持续里程：" + getFloatDis(map, "MsgERC_RunKm");
				tipContentShort = "开始："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ " 结束："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ " 持续里程：" + getFloatDis(map, "MsgERC_RunKm");
				sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),'"
						+ tipContent
						+ "','',"
						+ handlerSysE_ID
						+ ",'"
						+ MapGetter.getString(map, "MsgER_RcvTime") + "',?)";
				sqlList.add(sql);
				paramList.add(new Object[] {
						MapGetter.getString(map, "MsgER_Vcl_ID"),
						tipContentShort });
				break;
			}
			case 5:// 疲劳驾驶事件
			{
				handlerSysE_ID = 8;
				eventName = MapGetter.getString(locNameList.get(6), "locName");
				int driverTotal_H = getInt(map, "continuedTimeSec")/3600;
				int driverTotal_M = getInt(map, "continuedTimeSec")%3600/60;
				int driverTotal_S = getInt(map, "continuedTimeSec")%3600%60;
				
				int pDriverTotal_H = (getInt(map, "continuedTimeSec")-3600*4)/3600;
				pDriverTotal_H = pDriverTotal_H>=0?pDriverTotal_H:0;
				int pDriverTotal_M = (getInt(map, "continuedTimeSec")-3600*4)%3600/60;
				pDriverTotal_M = pDriverTotal_M>=0?pDriverTotal_M:0;
				int pDriverTotal_S = (getInt(map, "continuedTimeSec")-3600*4)%3600%60;
				pDriverTotal_S = pDriverTotal_S>=0?pDriverTotal_S:0;
				
				tipContent = "开始时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ "<br/>结束时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ "<br/>驾驶总时长：" + driverTotal_H + "小时"+driverTotal_M+"分钟"+driverTotal_S+"秒" +
								"<br/>"+MapGetter.getString(locNameList.get(6), "locName")+"时长："+pDriverTotal_H+"小时"+pDriverTotal_M+"分钟"+pDriverTotal_S+"秒";
				tipContentShort = "开始："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ " 结束："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ " 驾驶总时长：" + driverTotal_H + "时"+driverTotal_M+"分"+driverTotal_S+"秒 " +
								""+MapGetter.getString(locNameList.get(6), "locName")+"时长："+pDriverTotal_H+"时"+pDriverTotal_M+"分"+pDriverTotal_S+"秒";
				sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),'"
						+ tipContent
						+ "','',"
						+ handlerSysE_ID
						+ ",'"
						+ MapGetter.getString(map, "MsgER_RcvTime") + "',?)";
				sqlList.add(sql);
				paramList.add(new Object[] {
						MapGetter.getString(map, "MsgER_Vcl_ID"),
						tipContentShort });
				break;
			}
			case 6:// 急加速事件
			{
				handlerSysE_ID = 5;
				eventName = MapGetter.getString(locNameList.get(4), "locName");
				int driverTotal_H = getInt(map, "continuedTimeSec")/3600;
				int driverTotal_M = getInt(map, "continuedTimeSec")%3600/60;
				int driverTotal_S = getInt(map, "continuedTimeSec")%3600%60;
				tipContent = "开始时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ "<br/>结束时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ "<br/>持续时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒";
				tipContentShort = "开始："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ " 结束："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ " 持续时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>";
				sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),'"
						+ tipContent
						+ "','',"
						+ handlerSysE_ID
						+ ",'"
						+ MapGetter.getString(map, "MsgER_RcvTime") + "',?)";
				sqlList.add(sql);
				paramList.add(new Object[] {
						MapGetter.getString(map, "MsgER_Vcl_ID"),
						tipContentShort });
				break;
			}
			case 7:// 全油门事件
			{
				handlerSysE_ID = 6;
				eventName = MapGetter.getString(locNameList.get(5), "locName");
				tipContent = "发生时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0);
				tipContentShort = "发生时间："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0);
				sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),'"
						+ tipContent
						+ "','',"
						+ handlerSysE_ID
						+ ",'"
						+ MapGetter.getString(map, "MsgER_RcvTime") + "',?)";
				sqlList.add(sql);
				paramList.add(new Object[] {
						MapGetter.getString(map, "MsgER_Vcl_ID"),
						tipContentShort });
				break;
			}
			case 8:// 急刹车事件
			{
//				handlerSysE_ID = 7;
//				eventName = "急刹车";
//				int driverTotal_H = getInt(map, "continuedTimeSec")/3600;
//				int driverTotal_M = getInt(map, "continuedTimeSec")%3600/60;
//				int driverTotal_S = getInt(map, "continuedTimeSec")%3600%60;
//				tipContent = "开始时间："
//						+ DateControl.getFormatDate(
//								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
//						+ "<br/>结束时间："
//						+ DateControl.getFormatDate(
//								MapGetter.getString(map, "MsgERC_EndTime"), 0)
//						+ "<br/>开始点车速：" + getFloatDis(map, "MsgERC_BgnSpeed")
//						+ "<br/>结束点车速：" + getFloatDis(map, "MsgERC_EndSpeed")
//						+ "<br/>持续时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
//						+ "秒<br/>"
//						+ "<br/>持续里程："+getIntDis(map, "MsgERC_RunKm");
//				tipContentShort = "开始："
//						+ DateList.getFormatDate(
//								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
//						+ " 结束："
//						+ DateList.getFormatDate(
//								MapGetter.getString(map, "MsgERC_EndTime"), 0)
//						+ " 开始点车速：" + getFloatDis(map, "MsgERC_BgnSpeed")
//						+ " 结束点车速：" + getFloatDis(map, "MsgERC_EndSpeed")
//						+ " 持续时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
//						+ "秒<br/>"
//						+ "持续里程："+getIntDis(map, "MsgERC_RunKm");
				handlerSysE_ID = 7;
	    		eventName = "急刹车";
	    		tipContent = "发生时间："+ DateControl.getFormatDate(MapGetter.getString(map, "MsgERC_BgnTime"), 0)
	    				   + "<br/>记录次数：" + getFloatDis(map, "MsgERC_RecordTimes");
	    		tipContentShort = "发生时间："+ DateList.getFormatDate(MapGetter.getString(map, "MsgERC_BgnTime"), 0)
	    				       + " 记录次数：" + getFloatDis(map, "MsgERC_RecordTimes");
	    		
				sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),'"
						+ tipContent
						+ "','',"
						+ handlerSysE_ID
						+ ",'"
						+ MapGetter.getString(map, "MsgER_RcvTime") + "',?)";
				sqlList.add(sql);
				paramList.add(new Object[] {
						MapGetter.getString(map, "MsgER_Vcl_ID"),
						tipContentShort });
				break;
			}
			case 9:// 空挡滑行事件
			{
				handlerSysE_ID = 11;
				eventName = MapGetter.getString(locNameList.get(9), "locName");
				int driverTotal_H = getInt(map, "continuedTimeSec")/3600;
				int driverTotal_M = getInt(map, "continuedTimeSec")%3600/60;
				int driverTotal_S = getInt(map, "continuedTimeSec")%3600%60;
				tipContent = "开始时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ "<br/>结束时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ "<br/>地点：";
				tipContentShort = "开始："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ " 结束："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ " 地点：";
				try {
					String pos = "";
					if (!StringUtil.isNullOrEmpty(pos))
						pos = "未知";
					tipContent += pos;
					tipContentShort += pos;
				} catch (Exception e) {
					tipContent += "未知";
					tipContentShort += "未知";
				}
				tipContent += "<br/>持续时间：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>";
				tipContentShort += " 持续时间：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>";
				sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),'"
						+ tipContent
						+ "','',"
						+ handlerSysE_ID
						+ ",'"
						+ MapGetter.getString(map, "MsgER_RcvTime") + "',?)";
				sqlList.add(sql);
				paramList.add(new Object[] {
						MapGetter.getString(map, "MsgER_Vcl_ID"),
						tipContentShort });
				break;
			}
			case 10:// 超速行驶2事件(超速行驶)
			{
				handlerSysE_ID = 12;
				eventName = MapGetter.getString(locNameList.get(10), "locName");
				int driverTotal_H = getInt(map, "continuedTimeSec")/3600;
				int driverTotal_M = getInt(map, "continuedTimeSec")%3600/60;
				int driverTotal_S = getInt(map, "continuedTimeSec")%3600%60;
				tipContent = "开始时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ "<br/>结束时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ "<br/>超速时长：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>地点：";
				tipContentShort = "开始："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ " 结束："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ " 超速时长：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>地点：";
				try {
					String pos = "";
					if (!StringUtil.isNullOrEmpty(pos))
						pos = "未知";
					tipContent += pos;
					tipContentShort += pos;
				} catch (Exception e) {
					tipContent += "未知";
					tipContentShort += "未知";
				}
				double avgSpeed = 0;
				if(StringUtil.isNullOrEmpty(MapGetter.getString(map, "continuedTime"))
						&&getFloat(map, "continuedTime")!=0){
					avgSpeed = NumberFormat.div(getFloat(map, "MsgERC_RunKm")*3600, getFloat(map, "continuedTimeSec"));
				}
				tipContent += 
					"<br/>平均车速："+avgSpeed+"公里/小时" +
						"<br/>最大车速："+getFloatDis(map, "MsgERC_MaxSpeed")+"" +
								"<br/>持续里程："+getFloatDis(map, "MsgERC_RunKm")+"" +
										"<br/>车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
				
				tipContentShort += 
					"平均车速："+avgSpeed+
						"公里/小时 最大车速："+getFloatDis(map, "MsgERC_MaxSpeed")+
							" 持续里程："+getFloatDis(map, "MsgERC_RunKm")+
								" 车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
				
				sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),'"
						+ tipContent
						+ "','',"
						+ handlerSysE_ID
						+ ",'"
						+ MapGetter.getString(map, "MsgER_RcvTime") + "',?)";
				sqlList.add(sql);
				paramList.add(new Object[] {
						MapGetter.getString(map, "MsgER_Vcl_ID"),
						tipContentShort });
				break;
			}
			
			case 11:// 矿山超速行驶
			{
				handlerSysE_ID = 13;
				eventName = MapGetter.getString(locNameList.get(11), "locName");
				int driverTotal_H = getInt(map, "continuedTimeSec")/3600;
				int driverTotal_M = getInt(map, "continuedTimeSec")%3600/60;
				int driverTotal_S = getInt(map, "continuedTimeSec")%3600%60;
				tipContent = "开始时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ "<br/>结束时间："
						+ DateControl.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ "<br/>超速时长：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>地点：";
				tipContentShort = "开始："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_BgnTime"), 0)
						+ " 结束："
						+ DateList.getFormatDate(
								MapGetter.getString(map, "MsgERC_EndTime"), 0)
						+ " 超速时长：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S 
						+ "秒<br/>地点：";
				try {
					String pos = "";
					if (!StringUtil.isNullOrEmpty(pos))
						pos = "未知";
					tipContent += pos;
					tipContentShort += pos;
				} catch (Exception e) {
					tipContent += "未知";
					tipContentShort += "未知";
				}
				double avgSpeed = 0;
				if(StringUtil.isNullOrEmpty(MapGetter.getString(map, "continuedTime"))
						&&getFloat(map, "continuedTime")!=0){
					avgSpeed = NumberFormat.div(getFloat(map, "MsgERC_RunKm")*3600, getFloat(map, "continuedTimeSec"));
				}
				tipContent += 
					"<br/>平均车速："+avgSpeed+"公里/小时" +
						"<br/>最大车速："+getFloatDis(map, "MsgERC_MaxSpeed")+"" +
								"<br/>持续里程："+getFloatDis(map, "MsgERC_RunKm")+"" +
										"<br/>车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
				
				tipContentShort += 
					"平均车速："+avgSpeed+
						"公里/小时 最大车速："+getFloatDis(map, "MsgERC_MaxSpeed")+
							" 持续里程："+getFloatDis(map, "MsgERC_RunKm")+
								" 车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
				
				sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),'"
						+ tipContent
						+ "','',"
						+ handlerSysE_ID
						+ ",'"
						+ MapGetter.getString(map, "MsgER_RcvTime") + "',?)";
				sqlList.add(sql);
				paramList.add(new Object[] {
						MapGetter.getString(map, "MsgER_Vcl_ID"),
						tipContentShort });
				break;
			}
			
			}
			if (handlerSysE_ID != 0) {
				// 插入统一提示信息表
				// 指定时间内不重复发送
				String isOccuredSQL = "select count(1) cnt from SMS_SendRecord "
						+ "left join DrivingTipRecord on SSR_MsgID=Dtr_ID where Dtr_TipType="
						+ handlerSysE_ID
						+ " and SSR_Type="
						+ SMSPromptType.SMSDriverTip
						+ " and Dtr_VclId="
						+ MapGetter.getString(map, "MsgER_Vcl_ID") + " ";// 自定义判断是否重复发送SQL
				//判断 指定时间内是否重复发送
				boolean assFlag = smsInfoDAO.assTimeIsOccured(
						SMSCfgType.SMSCfgDriverTip, isOccuredSQL);
				//判断非工作时间内是否重复发送
				boolean nonWorkFlag = smsInfoDAO.nonWorkIsOccured(
						SMSCfgType.SMSCfgDriverTip, "Dtr_TipTime",
						CurrentDate.getStringDateLong(), isOccuredSQL);
				String SMSContent = SMSContentCfg.SMSCCfgDriverTip;// 短信内容
				SMSContent = SMSContent
						.replace(
								SMSContentCfg.X_VclNum,
								MapGetter.getString(vclMap,
										"VehicleNumber"))
						.replace(SMSContentCfg.X_DriverTip, eventName)
						.replace(SMSContentCfg.X_Content,
								tipContentShort);
				
				//邮件发送-----------改为日报，不实时发送-----------------------
//				List<Map<String,Object>> userMailList = smsInfoDAO.getSMSUsers(MapGetter.getString(vclMap, "DBCode"), "SMSAS_MailBehavior");//邮件接收人
//				
//				String mailSuje = MailCfg.getMailSujeInfo(MapGetter.getString(vclMap, "VehicleNumber"),
//						MapGetter.getString(map, "MsgER_MsgTime"), MailCfg.MailSujeDriverTip); //邮件主题初始化
//				
//				String mailContent = SMSContent;//邮件内容初始化
//				
//				SendMail.getInstance().sendMail(mailSuje, mailContent, userMailList, "Email");//发送邮件，暂未对发送状态进行判断处理
				
				//邮件发送----------------------------------
				
				if(assFlag||nonWorkFlag) {//指定时间内发送过短信,或者非工作时间内发送过短信
					/** 2013.03.27 haoyang 修改 begin */
					/**优化版本取消向"提示表"中插入数据  2015.1.12 SXH */
					/*sql = "insert into Msg_Prompt(MsgP_VclID,MsgP_MsgID,MsgP_MsgCID,MsgP_MsgTime,MsgP_Type,MsgP_DBName,MsgP_TableName,MsgP_UpdateTime,MsgP_CreateTime,"
							+ "MsgP_DetailMsg,MsgP_SecTypeId,MsgP_SecTypeName)"
							+ "values("
							+ MapGetter.getString(map, "MsgER_Vcl_ID")
							+ ",IDENT_CURRENT('DrivingTipRecord'),IDENT_CURRENT('DrivingTipRecord'),GETDATE(),"
							+ SMSPromptType.SMSDriverTip
							+ ",'M','DTR',GETDATE(),GETDATE(),?,?,?);";
					sqlList.add(sql);
					Map<String, Object> dtrMsg = getDtrMsg(handlerSysE_ID + "",
							tipContent,eventName);
					paramList.add(new Object[] {
							MapGetter.getString(dtrMsg, "MsgP_DetailMsg"),
							MapGetter.getString(dtrMsg, "MsgP_SecTypeId"),
							MapGetter.getString(dtrMsg, "MsgP_SecTypeName") });*/
					/** end */
				}else{// 指定时间内未重复发送,且非工作时间内也没有重复发送
					// 非工作时间内不重复发送，即第二天工作时间起点只发一次
					/** 2013.03.27 haoyang 修改,同步插入短信接收人 begin */
					/**优化版本取消向"提示表"中插入数据  2015.1.12 SXH */
					/*sql = "insert into Msg_Prompt(MsgP_VclID,MsgP_MsgID,MsgP_MsgCID,MsgP_MsgTime,MsgP_Type,MsgP_DBName,MsgP_TableName,MsgP_UpdateTime,MsgP_CreateTime,"
							+ "MsgP_DetailMsg,MsgP_SecTypeId,MsgP_SecTypeName,MsgP_SMSRecUser)"
							+ "values("
							+ MapGetter.getString(map, "MsgER_Vcl_ID")
							+ ",IDENT_CURRENT('DrivingTipRecord'),IDENT_CURRENT('DrivingTipRecord'),GETDATE(),"
							+ SMSPromptType.SMSDriverTip
							+ ",'M','DTR',GETDATE(),GETDATE(),?,?,?,?);";
					sqlList.add(sql);
					Map<String, Object> dtrMsg = getDtrMsg(handlerSysE_ID + "",
							tipContent,eventName);*/
					//获取短信接收人
					List<Map<String,Object>> userList = smsInfoDAO.getSMSUsers("SMSAS_SMSBehavior", MapGetter.getString(vclMap, "DBCode"), MapGetter.getString(map, "MsgER_Vcl_ID"));
					String recUsers = smsInfoDAO.getSMSUsers(userList);
					if(StringUtil.isNullOrEmpty(recUsers))
						recUsers = "，"+recUsers;
					/*paramList.add(new Object[] {
							MapGetter.getString(dtrMsg, "MsgP_DetailMsg"),
							MapGetter.getString(dtrMsg, "MsgP_SecTypeId"),
							MapGetter.getString(dtrMsg, "MsgP_SecTypeName"),
							recUsers});*/
					/** end */
						Map<String, Object> vclInfoMap = new HashMap<String, Object>();// 设备信息
						vclInfoMap.put("DBCode",
								MapGetter.getString(vclMap, "DBCode"));
						vclInfoMap.put("VehicleID",
								MapGetter.getString(map, "MsgER_Vcl_ID"));
						Map<String, Object> SMSMap = new HashMap<String, Object>();// 短信信息
						SMSMap.put("SMSType", "SMSAS_SMSBehavior");
						SMSMap.put("TabName", "DrivingTipRecord");
						SMSMap.put("TabNameShort", "DTR");
						SMSMap.put("SMSContent", SMSContent);
						SMSMap.put("PromptType", SMSPromptType.SMSDriverTip);
						SMSMap.put("CreateType", "1");
						SMSMap.put("DBName", "M");
						SMSMap.put("SMSCfgType", SMSCfgType.SMSCfgDriverTip);
						SMSMap.put("DBCode", MapGetter.getString(vclMap, "DBCode"));
						//发送短信
						smsInfoDAO.loadSMSInfo(sqlList, paramList, SMSMap,
								userList);
					}
				}
//			}
		}
		//优化版本 取消 向提示表中插入信息  2015-1-12 SXH
		//drivingBehaviorDAO.drivingBehaviorTipIn(sqlList, paramList);
		
		if(Integer.parseInt(eventIDDef[1])>0){
			this.drivingBehaviorDAO.updateWorkedEventID(eventIDDef[1]);
		}
	}
	// 9种驾驶行为提示
	public void drivingBehaviorTipHandlenew() {
		Date date0 = new Date();
		
		String[] eventIDDef = this.drivingBehaviorDAO.getEventIDDef();
		
		Date date1 = new Date();
		System.out.println("驾驶行为提示的开始时间$"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date1));
		System.out.println("获取此次驾驶行为提示数据的标志的时间是$"+(date1.getTime()-date0.getTime()));
		//获取此次需要提示的驾驶行为源数据
		List<Map<String, Object>> list = drivingBehaviorDAO.drivingBehaviorTip(eventIDDef);
		//获取IEMS支持驾驶行为的设备信息,校验某条事件源信息所属设备是否是IEMS的设备
		Map<String,Map<String,Object>> vclsMap = drivingBehaviorDAO.getVclMap();
		/*wangkai20141016，3.6.6新增驾驶行为提示开关判断，判断逻辑如下
		 * 1，从提示开关表中获取“驾驶行为提示开关”为关的设备id集合
		 * 2，对获取到的所有设备进行筛选如果设备号在“驾驶行为提示开关”为关的设备id集合内则不处理
		*/
		/******************获取传感器提示开关为关的设备id的集合begin******************/
		List<String> drivingBehaviorPSDown = drivingBehaviorDAO.getdrivingPromtPSwitch();
		/******************获取传感器提示开关为关的设备id的集合end********************/
		
		Date date2 = new Date();
		System.out.println("获取此次驾驶行为提示数据时间是 $"+(date2.getTime()-date1.getTime())+",此次获取行为数:"+list.size());
		
		//如果驾驶行为源数据不为null
		if(null!=list&&!list.isEmpty()){
			this.sqlTipList = new ArrayList<String>();
			this.paramTipList = new ArrayList<Object[]>();
			//驾驶行为事件名称(1:中文)
			this.locNameList = drivingBehaviorDAO.getLocNameList(1);
			boolean smsSuport = this.smsInfoDAO.getSmsSendList().contains("SMSAS_SMSBehavior");
			Map<String, Object> tempMap = null;
			Map<String,Object> tempVcl = null;
			boolean flag = false;
			for (Iterator<Map<String, Object>> iterator = list.iterator(); iterator.hasNext();) {
				tempMap = (Map<String, Object>) iterator.next();
				//设备id是否在集合drivingBehaviorPSDown中存在，如果存在则不统计3.6.6新增20141016王凯
				if(!drivingBehaviorPSDown.contains(MapGetter.getString(tempMap, "MsgER_Vcl_ID"))){
					//此条驾驶行为信息不是IEMS设备时，跳出当前循环
					if(!vclsMap.containsKey(MapGetter.getString(tempMap, "MsgER_Vcl_ID")))continue;
					tempVcl = vclsMap.get(MapGetter.getString(tempMap, "MsgER_Vcl_ID"));
					flag = this.makeDrivingTip(tempMap,tempVcl,smsSuport);
					//根据执行标志显示不同信息，未使用
					if(flag){
						//执行成功，未使用
					}else{
						//执行失败，未使用
					}
			     }
			}
			Date date3 = new Date();
			System.out.println("此次驾驶行为提示数据进行处理（拼接SQL）用时$"+(date3.getTime()-date2.getTime()));
			
			if(null!=this.sqlTipList&&!this.sqlTipList.isEmpty()&&null!=this.paramTipList&&!this.paramTipList.isEmpty()){
				drivingBehaviorDAO.drivingBehaviorTipIn(this.sqlTipList, this.paramTipList);
			}
			
			Date date4 = new Date();
			System.out.println("此次驾驶行为提示数据进行处理（执行SQL）用时$"+(date4.getTime()-date3.getTime()));
			
			if(Integer.parseInt(eventIDDef[1])>0){
				this.drivingBehaviorDAO.updateWorkedEventID(eventIDDef[1]);
			}
			Date date5 = new Date();
			System.out.println("最后更新驾驶行为提示记录表用时$"+(date5.getTime()-date4.getTime()));
			System.out.println("此次驾驶行为提示记录共用时$"+(date5.getTime()-date0.getTime())/1000+"  秒");
			
		}else{
			//如没有需要提示的驾驶行为源数据，则什么也不做。
			System.out.println("此次驾驶行为源数据条数为0，直接结束此次任务");
		}
		
	}
	/**
	 * 提示一条驾驶行为
	 * @param Map<String, Object> oneDrivingMap 一条驾驶行为提示信息
	 * @param Map<String, Object> vclMap 设备信息
	 * @param boolean supportDrTip 当前系统是否支持发送驾驶行为
	 * @return boolean flag 目前没有使用
	 **/
	@SuppressWarnings("unchecked")
	private boolean makeDrivingTip( Map<String, Object> oneDrivingMap,Map<String, Object> vclMap,boolean supportDrTip) {
		boolean flag = true;//返回值，
		int SysE_ID = getInt(oneDrivingMap, "MsgERC_SysE_ID");
		int handlerSysE_ID = 0;//IEMS 驾驶行为事件的ID索引
		String tipContent = "";
		String tipContentShort = "";
		String sql = "INSERT INTO DrivingTipRecord(Dtr_VclId,Dtr_TipTime,Dtr_TipContent,Dtr_TipPerson,Dtr_TipType,Dtr_SrcMsgTime,Dtr_TipContentShort) VALUES(?,GETDATE(),";
		String eventName = "";
		String pos = "未知" ;//驾驶行为提示的地点都是未知，以后可能会变更
		//事件持续时间 
		int driverTotal_H = 0;
		int driverTotal_M = 0;
		int driverTotal_S = 0;
		switch (SysE_ID) {
		     case 1: // 怠速时间过长事件
		    	 {
		    		 driverTotal_H = getInt(oneDrivingMap, "continuedTimeSec")/3600;
		    		 driverTotal_M = getInt(oneDrivingMap, "continuedTimeSec")%3600/60;
		    		 driverTotal_S = getInt(oneDrivingMap, "continuedTimeSec")%3600%60;
		    		 handlerSysE_ID = 2;
		    		 eventName = "怠速时间过长";
		    		 tipContent = "开始时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				 + "<br/>结束时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				 + "<br/>总怠速时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒" 
		    				 + "<br/>地点："+pos;
			         tipContentShort = "开始："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
			        		 + " 结束："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
			        		 + " 总怠速时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒" 
			        		 + " 地点："+pos;
					 break;
				}
		    case 2:// 超速行驶1事件(高速行驶)
		    	{
		    		handlerSysE_ID = 3;
		    		eventName = MapGetter.getString(this.locNameList.get(2), "locName");
		    		driverTotal_H = getInt(oneDrivingMap, "continuedTimeSec")/3600;
		    		driverTotal_M = getInt(oneDrivingMap, "continuedTimeSec")%3600/60;
		    		driverTotal_S = getInt(oneDrivingMap, "continuedTimeSec")%3600%60;
		    		tipContent = "开始时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				+ "<br/>结束时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				+ "<br/>"+eventName.trim()+"时长：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+"秒" 
		    				+ "<br/>地点："+pos;
		    		tipContentShort = "开始："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				       + " 结束："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				       + eventName.trim()+"时长：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒" 
		    				       + "<br/>地点："+pos;
					double avgSpeed = 0;
					if(StringUtil.isNullOrEmpty(MapGetter.getString(oneDrivingMap, "continuedTime"))&&getFloat(oneDrivingMap, "continuedTime")!=0){
						avgSpeed = NumberFormat.div(getFloat(oneDrivingMap, "MsgERC_RunKm")*3600, getFloat(oneDrivingMap, "continuedTimeSec"));
					}
					tipContent +="<br/>平均车速："+avgSpeed+"公里/小时" 
					           +"<br/>最大车速："+getFloatDis(oneDrivingMap, "MsgERC_MaxSpeed") 
					           +"<br/>持续里程："+getFloatDis(oneDrivingMap, "MsgERC_RunKm")
					           +"<br/>车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
					tipContentShort += "平均车速："+avgSpeed+"公里/小时 " 
					                +" 最大车速："+getFloatDis(oneDrivingMap, "MsgERC_MaxSpeed")
							        +" 持续里程："+getFloatDis(oneDrivingMap, "MsgERC_RunKm")
							        +" 车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
					break;
			    }
		    case 3:// 空挡踩油门事件
		    	{
		    		handlerSysE_ID = 10;
		    		eventName = MapGetter.getString(this.locNameList.get(8), "locName");
		    		tipContent = "发生时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0);
		    		tipContentShort = "发生时间："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0);
		    		break;
		    	}
		    case 4:// 低档高速事件
		    	{
		    		handlerSysE_ID = 4;
		    		driverTotal_H = getInt(oneDrivingMap, "continuedTimeSec")/3600;
		    		driverTotal_M = getInt(oneDrivingMap, "continuedTimeSec")%3600/60;
		    		driverTotal_S = getInt(oneDrivingMap, "continuedTimeSec")%3600%60;
		    		eventName = MapGetter.getString(locNameList.get(3), "locName");
		    		tipContent = "开始时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				+ "<br/>结束时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				+ "<br/>持续时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S
		    				+ "秒<br/>持续里程：" + getFloatDis(oneDrivingMap, "MsgERC_RunKm");
		    		tipContentShort = "开始："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				        + " 结束："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				        + " 持续里程：" + getFloatDis(oneDrivingMap, "MsgERC_RunKm");
		    		break;
		    	}
		    case 5:// 疲劳驾驶事件
		    	{
		    		handlerSysE_ID = 8;
		    		eventName = MapGetter.getString(this.locNameList.get(6), "locName");
		    		driverTotal_H = getInt(oneDrivingMap, "continuedTimeSec")/3600;
		    		driverTotal_M = getInt(oneDrivingMap, "continuedTimeSec")%3600/60;
		    		driverTotal_S = getInt(oneDrivingMap, "continuedTimeSec")%3600%60;
		    		int pDriverTotal_H = (getInt(oneDrivingMap, "continuedTimeSec")-3600*4)/3600;
		    		pDriverTotal_H = pDriverTotal_H>=0?pDriverTotal_H:0;
		    		int pDriverTotal_M = (getInt(oneDrivingMap, "continuedTimeSec")-3600*4)%3600/60;
		    		pDriverTotal_M = pDriverTotal_M>=0?pDriverTotal_M:0;
		    		int pDriverTotal_S = (getInt(oneDrivingMap, "continuedTimeSec")-3600*4)%3600%60;
		    		pDriverTotal_S = pDriverTotal_S>=0?pDriverTotal_S:0;
		    		tipContent = "开始时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				   + "<br/>结束时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				   + "<br/>驾驶总时长：" + driverTotal_H + "小时"+driverTotal_M+"分钟"+driverTotal_S+"秒" 
		    				   + "<br/>"+eventName.trim()+"时长："+pDriverTotal_H+"小时"+pDriverTotal_M+"分钟"+pDriverTotal_S+"秒";
		    		tipContentShort = "开始："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				        + " 结束："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				        + " 驾驶总时长：" + driverTotal_H + "时"+driverTotal_M+"分"+driverTotal_S+"秒 " 
							        + eventName.trim()+"时长："+pDriverTotal_H+"时"+pDriverTotal_M+"分"+pDriverTotal_S+"秒";
		    		break;
		    	}
		    case 6:// 急加速事件
		    	{
		    		handlerSysE_ID = 5;
		    		eventName = MapGetter.getString(this.locNameList.get(4), "locName");
		    		driverTotal_H = getInt(oneDrivingMap, "continuedTimeSec")/3600;
		    		driverTotal_M = getInt(oneDrivingMap, "continuedTimeSec")%3600/60;
		    		driverTotal_S = getInt(oneDrivingMap, "continuedTimeSec")%3600%60;
		    		tipContent = "开始时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
					           + "<br/>结束时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
					           + "<br/>持续时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒";
		    		tipContentShort = "开始："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				        + " 结束："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				        + " 持续时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒<br/>";
		    		break;
		    	}
		    case 7:// 全油门事件
		    	{
		    		handlerSysE_ID = 6;
		    		eventName = MapGetter.getString(this.locNameList.get(5), "locName");
		    		tipContent = "发生时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0);
		    		tipContentShort = "发生时间："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0);
		    		break;
		    	}
		    case 8:// 急刹车事件
		    	{
//		    		handlerSysE_ID = 7;
//		    		eventName = "急刹车";
//		    		driverTotal_H = getInt(oneDrivingMap, "continuedTimeSec")/3600;
//		    		driverTotal_M = getInt(oneDrivingMap, "continuedTimeSec")%3600/60;
//		    		driverTotal_S = getInt(oneDrivingMap, "continuedTimeSec")%3600%60;
//		    		tipContent = "开始时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
//		    				   + "<br/>结束时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
//		    				   + "<br/>开始点车速：" + getFloatDis(oneDrivingMap, "MsgERC_BgnSpeed")
//		    				   + "<br/>结束点车速：" + getFloatDis(oneDrivingMap, "MsgERC_EndSpeed")
//		    				   + "<br/>持续时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒"
//		    				   + "<br/>持续里程："+getIntDis(oneDrivingMap, "MsgERC_RunKm");
//		    		tipContentShort = "开始："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
//		    				       + " 结束："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
//		    				       + " 开始点车速：" + getFloatDis(oneDrivingMap, "MsgERC_BgnSpeed")
//		    				       + " 结束点车速：" + getFloatDis(oneDrivingMap, "MsgERC_EndSpeed")
//		    				       + " 持续时间：" + driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒"
//		    				       + " 持续里程："+getIntDis(oneDrivingMap, "MsgERC_RunKm");
//		    		break;
		    		handlerSysE_ID = 7;
		    		eventName = "急刹车";
		    		tipContent = "发生时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				   + "<br/>记录次数：" + getFloatDis(oneDrivingMap, "MsgERC_RecordTimes")
		    				   + "<br/>地点："+pos;
		    		tipContentShort = "发生时间："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				       + " 记录次数：" + getFloatDis(oneDrivingMap, "MsgERC_RecordTimes")
		    					   + "<br/>地点："+pos;
		    	
		    		break;
		    	}
		    case 9:// 空挡滑行事件
		    	{
		    		handlerSysE_ID = 11;
		    		eventName = MapGetter.getString(this.locNameList.get(9), "locName");
		    		driverTotal_H = getInt(oneDrivingMap, "continuedTimeSec")/3600;
		    		driverTotal_M = getInt(oneDrivingMap, "continuedTimeSec")%3600/60;
		    		driverTotal_S = getInt(oneDrivingMap, "continuedTimeSec")%3600%60;
		    		tipContent = "开始时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				   + "<br/>结束时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				   + "<br/>地点："+pos
		    				   + "<br/>持续时间：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒<br/>";
		    		tipContentShort = "开始："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				        + " 结束："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				        + " 地点："+pos
		    				        + " 持续时间：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒<br/>";
		    		break;
		    	}
		    case 10:// 超速行驶2事件(超速行驶)
		    	{
		    		handlerSysE_ID = 12;
		    		eventName = MapGetter.getString(this.locNameList.get(10), "locName");
		    		driverTotal_H = getInt(oneDrivingMap, "continuedTimeSec")/3600;
		    		driverTotal_M = getInt(oneDrivingMap, "continuedTimeSec")%3600/60;
		    		driverTotal_S = getInt(oneDrivingMap, "continuedTimeSec")%3600%60;
		    		tipContent = "开始时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				   + "<br/>结束时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				   + "<br/>超速时长：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒" 
		    				   + "<br/>地点："+pos;
			        tipContentShort = "开始："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
					                + " 结束："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
					                + " 超速时长：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒" 
					                + " 地点："+pos;
			        double avgSpeed = 0;
			        if(StringUtil.isNullOrEmpty(MapGetter.getString(oneDrivingMap, "continuedTime"))&&getFloat(oneDrivingMap, "continuedTime")!=0){
			        	avgSpeed = NumberFormat.div(getFloat(oneDrivingMap, "MsgERC_RunKm")*3600, getFloat(oneDrivingMap, "continuedTimeSec"));
			        }
			        tipContent +="<br/>平均车速："+avgSpeed+"公里/小时" 
			                   +"<br/>最大车速："+getFloatDis(oneDrivingMap, "MsgERC_MaxSpeed") 
			                   +"<br/>持续里程："+getFloatDis(oneDrivingMap, "MsgERC_RunKm")
			                   +"<br/>车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
			        tipContentShort +="平均车速："+avgSpeed+"公里/小时 " 
			                        +" 最大车速："+getFloatDis(oneDrivingMap, "MsgERC_MaxSpeed")
			        		        +" 持续里程："+getFloatDis(oneDrivingMap, "MsgERC_RunKm")
			        		        +" 车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
			        break;
			    }
		    case 11:// 矿山超速行驶
		    	{
		    		handlerSysE_ID = 13;
		    		eventName = MapGetter.getString(this.locNameList.get(11), "locName");
		    		driverTotal_H = getInt(oneDrivingMap, "continuedTimeSec")/3600;
		    		driverTotal_M = getInt(oneDrivingMap, "continuedTimeSec")%3600/60;
		    		driverTotal_S = getInt(oneDrivingMap, "continuedTimeSec")%3600%60;
		    		tipContent = "开始时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				   + "<br/>结束时间："+ DateControl.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				   + "<br/>超速时长：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒" 
		    				   + "<br/>地点："+pos;
		    		tipContentShort = "开始："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_BgnTime"), 0)
		    				        + " 结束："+ DateList.getFormatDate(MapGetter.getString(oneDrivingMap, "MsgERC_EndTime"), 0)
		    				        + " 超速时长：" +  driverTotal_H + "时" + driverTotal_M + "分" + driverTotal_S+ "秒" 
		    				        + " 地点："+pos;
		    		double avgSpeed = 0;
		    		if(StringUtil.isNullOrEmpty(MapGetter.getString(oneDrivingMap, "continuedTime"))&&getFloat(oneDrivingMap, "continuedTime")!=0){
		    			avgSpeed = NumberFormat.div(getFloat(oneDrivingMap, "MsgERC_RunKm")*3600, getFloat(oneDrivingMap, "continuedTimeSec"));
		    		}
		    		tipContent +="<br/>平均车速："+avgSpeed+"公里/小时" 
		    		           +"<br/>最大车速："+getFloatDis(oneDrivingMap, "MsgERC_MaxSpeed")
		    		           +"<br/>持续里程："+getFloatDis(oneDrivingMap, "MsgERC_RunKm")
		    		           +"<br/>车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
		    		tipContentShort +="平均车速："+avgSpeed
		    				        +"公里/小时 最大车速："+getFloatDis(oneDrivingMap, "MsgERC_MaxSpeed")
		    				        +" 持续里程："+getFloatDis(oneDrivingMap, "MsgERC_RunKm")
		    				        +" 车辆标识："+MapGetter.getString(vclMap, "VehicleNumber");
		    		break;
		    	}
		}
		if(StringUtil.isValid(tipContent)&&StringUtil.isValid(tipContentShort)){
			sql += "'"+ tipContent+ "','',"+ handlerSysE_ID+ ",'"+ MapGetter.getString(oneDrivingMap, "MsgER_RcvTime") + "',?)";
			this.sqlTipList.add(sql);
			this.paramTipList.add(new Object[] {MapGetter.getString(oneDrivingMap, "MsgER_Vcl_ID"),tipContentShort });
		}
		/****拼写录入msg_prompt表**开始**/
		//如果IEMS中该事件的ID存在，即事件信息是需要提示的
		if (handlerSysE_ID != 0) {
			//将详细信息、事件信息调整方便生成msg_prompt信息
			Map<String, Object> dtrMsg = getDtrMsg(String.valueOf(handlerSysE_ID),tipContent,eventName);
			//如果当前系统支持发送驾驶行为短信
			boolean smsFlag = false;
			if(supportDrTip){
				if(null==this.userInfos||this.userInfos.isEmpty()){
					this.userInfos = new HashMap<String,Object>();
				}
				//获取短信接收人
				List<Map<String,Object>> userList = null;
				if(this.userInfos.containsKey(MapGetter.getString(oneDrivingMap, "MsgER_Vcl_ID"))){
					userList = (List<Map<String,Object>>)this.userInfos.get(MapGetter.getString(oneDrivingMap, "MsgER_Vcl_ID")); 
				}else{
					userList = this.smsInfoDAO.getSMSUsers("SMSAS_SMSBehavior", MapGetter.getString(vclMap, "DBCode"), MapGetter.getString(oneDrivingMap, "MsgER_Vcl_ID"));
					this.userInfos.put(MapGetter.getString(oneDrivingMap, "MsgER_Vcl_ID"), userList);
				}
				//短信接收人不为null
				if(null!=userList && !userList.isEmpty()){
					String isOccuredSQL = "select count(1) cnt from SMS_SendRecord "
							+ "left join DrivingTipRecord on SSR_MsgID=Dtr_ID where Dtr_TipType="
							+ handlerSysE_ID
							+ " and SSR_Type="
							+ SMSPromptType.SMSDriverTip
							+ " and Dtr_VclId="
							+ MapGetter.getString(oneDrivingMap, "MsgER_Vcl_ID") + " ";
					//判断 指定时间内是否重复发送,已发送为true
					boolean assFlag = smsInfoDAO.assTimeIsOccured(SMSCfgType.SMSCfgDriverTip, isOccuredSQL);
					//判断非工作时间内是否重复发送，已发送为true
					boolean nonWorkFlag = smsInfoDAO.nonWorkIsOccured(SMSCfgType.SMSCfgDriverTip, "Dtr_TipTime",CurrentDate.getStringDateLong(), isOccuredSQL);
					if(!assFlag&&!nonWorkFlag){
						smsFlag = true;
						sql = "insert into Msg_Prompt(MsgP_VclID,MsgP_MsgID,MsgP_MsgCID,MsgP_MsgTime,MsgP_Type,MsgP_DBName,MsgP_TableName,MsgP_UpdateTime,MsgP_CreateTime,"
								+ "MsgP_DetailMsg,MsgP_SecTypeId,MsgP_SecTypeName,MsgP_SMSRecUser)"
								+ "values("
								+ MapGetter.getString(oneDrivingMap, "MsgER_Vcl_ID")
								+ ",IDENT_CURRENT('DrivingTipRecord'),IDENT_CURRENT('DrivingTipRecord'),GETDATE(),"
								+ SMSPromptType.SMSDriverTip
								+ ",'M','DTR',GETDATE(),GETDATE(),?,?,?,?);";
						String recUsers = smsInfoDAO.getSMSUsers(userList);
						if(StringUtil.isNullOrEmpty(recUsers))
							recUsers = "，"+recUsers;
						this.sqlTipList.add(sql);
						this.paramTipList.add(new Object[] {
								MapGetter.getString(dtrMsg, "MsgP_DetailMsg"),
								MapGetter.getString(dtrMsg, "MsgP_SecTypeId"),
								MapGetter.getString(dtrMsg, "MsgP_SecTypeName"),
								recUsers});
						// 插入统一提示信息表
						String SMSContent = SMSContentCfg.SMSCCfgDriverTip;// 短信内容
						SMSContent = SMSContent
								.replace(
										SMSContentCfg.X_VclNum,
										MapGetter.getString(vclMap,
												"VehicleNumber"))
								.replace(SMSContentCfg.X_DriverTip, eventName)
								.replace(SMSContentCfg.X_Content,
										tipContentShort);
						Map<String, Object> SMSMap = new HashMap<String, Object>();// 短信信息
						SMSMap.put("SMSType", "SMSAS_SMSBehavior");
						SMSMap.put("TabName", "DrivingTipRecord");
						SMSMap.put("TabNameShort", "DTR");
						SMSMap.put("SMSContent", SMSContent);
						SMSMap.put("PromptType", SMSPromptType.SMSDriverTip);
						SMSMap.put("CreateType", "1");
						SMSMap.put("DBName", "M");
						SMSMap.put("SMSCfgType", SMSCfgType.SMSCfgDriverTip);
						SMSMap.put("DBCode", MapGetter.getString(vclMap, "DBCode"));
						//发送短信
						smsInfoDAO.loadSMSInfo(this.sqlTipList, this.paramTipList, SMSMap,userList);
					}
				}
			}
			//不需要发送短信：当前系统不支持、无短信接收人、半小时重复发送、非工作时间已发送
			if(!smsFlag){
				sql = "insert into Msg_Prompt(MsgP_VclID,MsgP_MsgID,MsgP_MsgCID,MsgP_MsgTime,MsgP_Type,MsgP_DBName,MsgP_TableName,MsgP_UpdateTime,MsgP_CreateTime,"
						+ "MsgP_DetailMsg,MsgP_SecTypeId,MsgP_SecTypeName)"
						+ "values("
						+ MapGetter.getString(oneDrivingMap, "MsgER_Vcl_ID")
						+ ",IDENT_CURRENT('DrivingTipRecord'),IDENT_CURRENT('DrivingTipRecord'),GETDATE(),"
						+ SMSPromptType.SMSDriverTip
						+ ",'M','DTR',GETDATE(),GETDATE(),?,?,?);";
				this.sqlTipList.add(sql);
				this.paramTipList.add(new Object[] {
						MapGetter.getString(dtrMsg, "MsgP_DetailMsg"),
						MapGetter.getString(dtrMsg, "MsgP_SecTypeId"),
						MapGetter.getString(dtrMsg, "MsgP_SecTypeName") });
			}
		}
		/****拼写录入msg_prompt表**结束**/
		return flag;
	}

	public DrivingBehaviorDAO getDrivingBehaviorDAO() {
		return drivingBehaviorDAO;
	}

	public void setDrivingBehaviorDAO(DrivingBehaviorDAO drivingBehaviorDAO) {
		this.drivingBehaviorDAO = drivingBehaviorDAO;
	}

	/**
	 * @return the smsInfoDAO
	 */
	public SMSInfoDAO getSmsInfoDAO() {
		return smsInfoDAO;
	}

	/**
	 * @param smsInfoDAO
	 *            the smsInfoDAO to set
	 */
	public void setSmsInfoDAO(SMSInfoDAO smsInfoDAO) {
		this.smsInfoDAO = smsInfoDAO;
	}

	/**
	 * 获取MAP中的Float类型的值
	 * 
	 * @param map
	 * @param key
	 * @return
	 */
	public static float getFloat(Map<String, Object> map, String key) {
		Object value = map.get(key);
		if (value == null) {
			return 0;
		}
		float result = 0;
		try {
			result = Float.parseFloat(value.toString());
		} catch (Exception e) {
		}
		return result;
	}

	/**
	 * 获取MAP中的Float类型的值
	 * 
	 * @param map
	 * @param key
	 * @return
	 */
	public static String getFloatDis(Map<String, Object> map, String key) {
		Object value = map.get(key);
		if (value == null) {
			return "--";
		}
		String result = "--";
		try {
			if (Float.parseFloat(value.toString()) >= 0) {
				result = value.toString();
			}
		} catch (Exception e) {
		}
		return result;
	}

	/**
	 * 获取MAP中的Int类型的值
	 * 
	 * @param map
	 * @param key
	 * @return
	 */
	public static int getInt(Map<String, Object> map, String key) {
		Object value = map.get(key);
		if (value == null) {
			return 0;
		}
		int result = 0;
		try {
			result = (int)Double.parseDouble(value.toString());
		} catch (Exception e) {
		}
		return result;
	}

	/**
	 * 获取MAP中的Int类型的值
	 * 
	 * @param map
	 * @param key
	 * @return
	 */
	public static String getIntDis(Map<String, Object> map, String key) {
		Object value = map.get(key);
		if (value == null) {
			return "--";
		}
		String result = "--";
		try {
			if (Double.parseDouble(value.toString()) >= 0) {
				result = String.valueOf((int)Double.parseDouble(value.toString()));
			}
		} catch (Exception e) {
		}
		return result;
	}

	/**
	 * 获取 Dtr信息
	 * 
	 * @param DtrTipType
	 * @param DtrTipContent
	 * @return
	 */
	public Map<String, Object> getDtrMsg(String DtrTipType, String DtrTipContent, String eventName) {
		Map<String, Object> dtrMsg = new HashMap<String, Object>();
		dtrMsg.put("MsgP_DetailMsg", eventName+ "，" + DtrTipContent);
		dtrMsg.put("MsgP_SecTypeId", DtrTipType);
		dtrMsg.put("MsgP_SecTypeName", eventName);
		return dtrMsg;
	}
}
